<?php
include "./include/om_config.inc";

if(isset($_REQUEST['submitBtn']))
{
  $min = $_REQUEST['minValue'];
  $item = array();
  $j = 0;
  $k = 0;
  $queryItem = "SELECT itemId, min
              FROM item";
  $queryItemRes = mysql_query($queryItem);
  while($itemRow = mysql_fetch_array($queryItemRes))
  {
    
   $updatQuery = "UPDATE item 
                    SET min = '".$min[$k]."' 
                  WHERE itemId = '".$itemRow['itemId']."' ";  
    $upRes = mysql_query($updatQuery);
    $k++;
 
  }
	
}
$itemArray = array();
$i = 0;
$queryItem = "SELECT itemId, min
                FROM item";
$queryItemRes = mysql_query($queryItem);
while($row = mysql_fetch_array($queryItemRes))
{
  $itemArray[$i]['itemId'] = $row['itemId'];
  $itemArray[$i]['min']    = $row['min'];
  $i++;
}

 

$smarty->assign('itemArray', $itemArray);
$smarty->display('itemList.tpl');
?>